package com.java.comprehensive.design.test.first;

/**
 * @Author: Dgg
 * @Date: 2022/2/8 22:56
 */
public class Movie {

	public static final int CHILDRENS = 2;
	public static final int REGULAR = 0;
	public static final int NEW_RELEASE = 1;

	private String _title;
	private int _priceCode;
	private Price price;

	public Movie(String _title, int _priceCode) {
		this._title = _title;
		set_priceCode(_priceCode);
	}

	public Movie() {
	}

	public double getCharge(int daysRented) {
		return price.getCharge(daysRented);
	}

	public int getFrequentRenterPoints(int daysRented) {
		return price.getFrequentRenterPoints(daysRented);
	}

	public int get_priceCode() {
		return _priceCode;
	}

	public void set_priceCode(int arg) {
		switch (arg) {
			case Movie.REGULAR:
				price = new RegularPrice();
				break;
			case Movie.NEW_RELEASE:
				price = new NewReleasePrice();
				break;
			case Movie.CHILDRENS:
				price = new ChildrensPrice();
				break;
			default:
				throw new IllegalArgumentException("Incorrect Price Code");
		}
	}

	public Price getPrice() {
		return price;
	}

	public void setPrice(Price price) {
		this.price = price;
	}

	public String get_title() {
		return _title;
	}

	public void set_title(String _title) {
		this._title = _title;
	}

}
